<?php
/*##################################################
# 模块功能：保存功能配置
###################################################*/
 require_once('class.db.php');
 session_start(); 
 if(isset($_SESSION['lock_config'])){ $time=(int)$_SESSION['lock_config']-(int)time(); if($time>0){ exit(json_encode(array('success'=>0,'icon'=>5,'msg'=>"请勿频繁提交，".$time."秒后再试！")));}}
 $_SESSION['lock_config']= time()+ $from_timeout;

 $lywq['AdManager']['status'] = filter_input(INPUT_POST, "lywq_AdManager_status");
 $lywq['AdManager']['terminal'] = implode("|", $_POST['lywq_AdManager_terminal']);
 
 //全局广告
 $lywq['AdManager']['all']['status'] = filter_input(INPUT_POST, "lywq_AdManager_all_status");
 $lywq['AdManager']['all']['code'] = filter_input(INPUT_POST, "lywq_AdManager_all_code");
 
 //详情页广告
 $lywq['AdManager']['detailF']['status'] = filter_input(INPUT_POST, "lywq_AdManager_detailF_status");
 $lywq['AdManager']['detailF']['code'] = filter_input(INPUT_POST, "lywq_AdManager_detailF_code");
 
 $lywq['AdManager']['detail']['status'] = filter_input(INPUT_POST, "lywq_AdManager_detail_status");
 $lywq['AdManager']['detail']['type'] = filter_input(INPUT_POST, "lywq_AdManager_detail_type");
 $lywq['AdManager']['detail']['code'] = filter_input(INPUT_POST, "lywq_AdManager_detail_code");
 $lywq['AdManager']['detail']['image'] = filter_input(INPUT_POST, "lywq_AdManager_detail_image");
 $lywq['AdManager']['detail']['url'] = filter_input(INPUT_POST, "lywq_AdManager_detail_url");
 
 //播放页广告
 $lywq['AdManager']['playF']['status'] = filter_input(INPUT_POST, "lywq_AdManager_playF_status");
 $lywq['AdManager']['playF']['code'] = filter_input(INPUT_POST, "lywq_AdManager_playF_code");
 
 $lywq['AdManager']['play']['status'] = filter_input(INPUT_POST, "lywq_AdManager_play_status");
 $lywq['AdManager']['play']['type'] = filter_input(INPUT_POST, "lywq_AdManager_play_type");
 $lywq['AdManager']['play']['code'] = filter_input(INPUT_POST, "lywq_AdManager_play_code");
 $lywq['AdManager']['play']['image'] = filter_input(INPUT_POST, "lywq_AdManager_play_image");
 $lywq['AdManager']['play']['url'] = filter_input(INPUT_POST, "lywq_AdManager_play_url");
 
 //搜索页广告
 $lywq['AdManager']['searchF']['status'] = filter_input(INPUT_POST, "lywq_AdManager_searchF_status");
 $lywq['AdManager']['searchF']['code'] = filter_input(INPUT_POST, "lywq_AdManager_searchF_code");
 
 $lywq['AdManager']['search']['status'] = filter_input(INPUT_POST, "lywq_AdManager_search_status");
 $lywq['AdManager']['search']['type'] = filter_input(INPUT_POST, "lywq_AdManager_search_type");
 $lywq['AdManager']['search']['code'] = filter_input(INPUT_POST, "lywq_AdManager_search_code");
 $lywq['AdManager']['search']['image'] = filter_input(INPUT_POST, "lywq_AdManager_search_image");
 $lywq['AdManager']['search']['url'] = filter_input(INPUT_POST, "lywq_AdManager_search_url");
 
 //文章页广告
 $lywq['AdManager']['articleF']['status'] = filter_input(INPUT_POST, "lywq_AdManager_articleF_status");
 $lywq['AdManager']['articleF']['code'] = filter_input(INPUT_POST, "lywq_AdManager_articleF_code");
 
 $lywq['AdManager']['article']['status'] = filter_input(INPUT_POST, "lywq_AdManager_article_status");
 $lywq['AdManager']['article']['type'] = filter_input(INPUT_POST, "lywq_AdManager_article_type");
 $lywq['AdManager']['article']['code'] = filter_input(INPUT_POST, "lywq_AdManager_article_code");
 $lywq['AdManager']['article']['image'] = filter_input(INPUT_POST, "lywq_AdManager_article_image");
 $lywq['AdManager']['article']['url'] = filter_input(INPUT_POST, "lywq_AdManager_article_url");
 
 //弹窗广告
 $lywq['AdManager']['pupop']['status'] = filter_input(INPUT_POST, "lywq_AdManager_pupop_status");
 $lywq['AdManager']['interval']['type'] = filter_input(INPUT_POST, "lywq_AdManager_interval_type");
 $lywq['AdManager']['interval']['time'] = filter_input(INPUT_POST, "lywq_AdManager_interval_time");
 $lywq['AdManager']['interval']['number'] = filter_input(INPUT_POST, "lywq_AdManager_interval_number");
 $lywq['AdManager']['pupop']['carousel'] = filter_input(INPUT_POST, "lywq_AdManager_pupop_carousel");
 $lywq['AdManager']['pupop']['type'] = filter_input(INPUT_POST, "lywq_AdManager_pupop_type");
 $lywq['AdManager']['pupop']['code1'] = filter_input(INPUT_POST, "lywq_AdManager_pupop_code1");
 $lywq['AdManager']['pupop']['code2'] = filter_input(INPUT_POST, "lywq_AdManager_pupop_code2");
 $lywq['AdManager']['pupop']['code3'] = filter_input(INPUT_POST, "lywq_AdManager_pupop_code3");
 $lywq['AdManager']['pupop']['image1'] = filter_input(INPUT_POST, "lywq_AdManager_pupop_image1");
 $lywq['AdManager']['pupop']['image2'] = filter_input(INPUT_POST, "lywq_AdManager_pupop_image2");
 $lywq['AdManager']['pupop']['image3'] = filter_input(INPUT_POST, "lywq_AdManager_pupop_image3");
 $lywq['AdManager']['pupop']['url1'] = filter_input(INPUT_POST, "lywq_AdManager_pupop_url1");
 $lywq['AdManager']['pupop']['url2'] = filter_input(INPUT_POST, "lywq_AdManager_pupop_url2");
 $lywq['AdManager']['pupop']['url3'] = filter_input(INPUT_POST, "lywq_AdManager_pupop_url3");
 $lywq['AdManager']['closepupop']['type'] = filter_input(INPUT_POST, "lywq_AdManager_closepupop_type");
 $lywq['AdManager']['closepupop']['button'] = filter_input(INPUT_POST, "lywq_AdManager_closepupop_button");
 $lywq['AdManager']['closepupop']['image'] = filter_input(INPUT_POST, "lywq_AdManager_closepupop_image");

 //分端展示
 $lywq['AdManager']['Zterminal'] = implode("|", $_POST['lywq_AdManager_Zterminal']);
 $lywq['AdManager']['pupop']['Zcode1'] = filter_input(INPUT_POST, "lywq_AdManager_pupop_Zcode1");
 $lywq['AdManager']['pupop']['Zcode2'] = filter_input(INPUT_POST, "lywq_AdManager_pupop_Zcode2");
 $lywq['AdManager']['pupop']['Zcode3'] = filter_input(INPUT_POST, "lywq_AdManager_pupop_Zcode3");
 $lywq['AdManager']['pupop']['Qcode1'] = filter_input(INPUT_POST, "lywq_AdManager_pupop_Qcode1");
 $lywq['AdManager']['pupop']['Qcode2'] = filter_input(INPUT_POST, "lywq_AdManager_pupop_Qcode2");
 $lywq['AdManager']['pupop']['Qcode3'] = filter_input(INPUT_POST, "lywq_AdManager_pupop_Qcode3");
 
 $lywq['AdManager']['detail']['Zcode'] = filter_input(INPUT_POST, "lywq_AdManager_detail_Zcode");
 $lywq['AdManager']['detail']['Qcode'] = filter_input(INPUT_POST, "lywq_AdManager_detail_Qcode");

 $lywq['AdManager']['play']['Zcode'] = filter_input(INPUT_POST, "lywq_AdManager_play_Zcode");
 $lywq['AdManager']['play']['Qcode'] = filter_input(INPUT_POST, "lywq_AdManager_play_Qcode");
 
 $lywq['AdManager']['search']['Zcode'] = filter_input(INPUT_POST, "lywq_AdManager_search_Zcode");
 $lywq['AdManager']['search']['Qcode'] = filter_input(INPUT_POST, "lywq_AdManager_search_Qcode");
 
 $lywq['AdManager']['article']['Zcode'] = filter_input(INPUT_POST, "lywq_AdManager_article_Zcode");
 $lywq['AdManager']['article']['Qcode'] = filter_input(INPUT_POST, "lywq_AdManager_article_Qcode");
 


 
if( Main_db::save()){
	exit(json_encode(array('success'=>1,'icon'=>1,'msg'=>"保存成功!")));
}else{
	exit(json_encode(array('success'=>0,'icon'=>0,'msg'=>"保存失败!请检测配置文件权限")));
} 

?>